package com.cc

import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.textfield.TextInputLayout

class MainActivity : AppCompatActivity() {
    lateinit var viewGroup: ViewGroup
    lateinit var editText: TextInputLayout
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        viewGroup = findViewById(R.id.csl)
        val danmuEngine = DanmuEngine(viewGroup)
        danmuEngine.defaultDanmuAnimator.isRevert = true
//        for (i in 0..3000) {
//            val danmuMessage = DanmuMessage()
//            danmuMessage.content = "wow..$i"
//            danmuEngine.postDelay(danmuMessage, i * 100L)
//        }
        editText = findViewById<TextInputLayout>(R.id.textInputLayout2)
        findViewById<View>(R.id.button).setOnClickListener {
            val danmuMessage = DanmuMessage()
            danmuMessage.content = editText.editText?.text.toString()
            danmuEngine.postDelay(danmuMessage, 100L)
        }
    }
}
